//
//  KZExamItemAnswerView.m
//  lg_zhinengbeikao_english
//
//  Created by 朱凯 on 2019/1/9.
//  Copyright © 2019 zhukai. All rights reserved.
//

#import "KZExamItemAnswerView.h"

// view
#import "KZAnswerClassFillingView.h"    // 填空题
#import "KZAnswerClassWrittingView.h"   // 写作题
#import "KZAnswerClassSelectingView.h"  // 选择题

@implementation KZExamItemAnswerView
{
}

- (instancetype)init {
    if (self = [super init]) {
        self.layer.masksToBounds = true;
    }
    return self;
}

- (void)setupUI {
    
    switch (_model.type) {
        case KZExamItemFilling:
        {
            KZAnswerClassFillingView *fillingView = [KZAnswerClassFillingView new];
            fillingView.model = _model;
            [self addSubview:fillingView];
            [fillingView mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.top.width.bottom.equalTo(self);
            }];
        }
            break;
        case KZExamItemWritting:
        {
            KZAnswerClassWrittingView *writtingView = [KZAnswerClassWrittingView new];
            writtingView.model = _model;
            [self addSubview:writtingView];
            [writtingView mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.top.width.bottom.equalTo(self);
            }];
        }
            break;
        case KZExamItemSelecting:
        {
            KZAnswerClassSelectingView *selectingView = [KZAnswerClassSelectingView new];
            selectingView.model = _model;
            [self addSubview:selectingView];
            [selectingView mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.top.width.bottom.equalTo(self);
            }];
        }
            break;
            
            
        default:
            break;
    }
    

}

#pragma mark - setter
- (void)setModel:(KZExamItemModel *)model{
    
    _model = model;
    [self setupUI];
}
@end
